import Vue from 'vue';
import iView from 'view-design';
import {router} from './router/index';
import {loginRouter,appRouter} from './router/router';
import store from './store';
import App from './App.vue';
import api from './api';
import './assets/my-theme/index.less'; //自定义iview组件主题颜色
import './assets/font/iconfont.css'; //引入自定义图标样式
import util from './assets/js/util'; //引入全局自定义方法
import Cookies from 'js-cookie'  //引入cookie缓存
import VueClipboard from 'vue-clipboard2' //复制
import $ from 'jquery' //引入JQ
import echarts from 'echarts'


//注册全局组件
import contentTemplate from './components/content/content.vue' //内容
import dialogTemplate from './components/content/dialogTemplate/dialogTemplate.vue' //弹框
import formTemplate from './components/content/formTemplate/formTemplate.vue' //表单
import tableSearch from './components/content/tableTemplate/tableSearch/tableSearch.vue' //搜索
import tableList from './components/content/tableTemplate/tableList/tableList.vue' //表格
import sidebarMenuShrink from './components/shrinkable-menu/components/sidebarMenuShrink.vue';
import verticalMenu from './components/shrinkable-menu/components/verticalMenu.vue'; //垂直菜单

Vue.component('contentTemplate', contentTemplate) //内容
Vue.component('dialogTemplate', dialogTemplate)   //弹框
Vue.component('formTemplate', formTemplate)       //表单
Vue.component('tableSearch', tableSearch)         //搜索
Vue.component('tableList', tableList)             //表格
Vue.component('sidebarMenuShrink', sidebarMenuShrink)   
Vue.component('verticalMenu', verticalMenu)      

import './assets/css/common.less';  //公共样式文件
import filters from './assets/js/filters'  //全局过滤器

// 全局注册自定义过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
Vue.prototype.$echarts = echarts
// 定义全局侧边栏菜单路由
Vue.prototype.menuRouter = appRouter;
// 引入全局的util
Vue.prototype.util = util;
// 引入全局的api接口
Vue.prototype.$api = api;
// 全局本地缓存
Vue.prototype.Cookies = Cookies;
// 图片前缀
Vue.prototype.$webUrl = api.baseHost;
// 上传图片接口
Vue.prototype.$imgApi = api.baseUrl + "/upload/image";
// 上传视频接口
Vue.prototype.$videoApi = api.baseUrl + "/upload/video";
// 上传音频接口
Vue.prototype.$audioApi = api.baseUrl + "/upload/audio";
// // 上传缩略图接口
// Vue.prototype.$videoApi = api.baseUrl + "/upload/video";

Vue.use(iView);
Vue.use(VueClipboard)

new Vue({
    el: '#app',
    router: router,
    store: store,
    render: h => h(App),
    mounted () {
        this.currentPageName = this.$route.name;
        // 权限菜单过滤相关
        this.$store.commit('updateMenulist');
    },
    created () {
       
    }
});
